import sys

graph = sys.stdin.read()
end = graph.find('#')
graph = graph[:end]
for i in graph:
    if i != '_' and not i.isalnum():
        graph = graph.replace(i,' ')
words = graph.lower().split()
count = {}
for i in words:
    i = i[:15]
    time = count.get(i,0)
    time += 1
    count[i] = time
count_lst = list(sorted(count.items(),key = lambda x:(-x[1],x[0])))
print(len(count_lst))
for k,v in count_lst:
    print(f"{v}:{k}")